package com.codebattery.config;

import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioAutoConfiguration {
   @Autowired
   private MinioProperties properties;

   @Bean
   public MinioClient  minioClient() throws InvalidPortException, InvalidEndpointException {
      MinioClient  client =new MinioClient(properties.getUrl(), properties.getAccessKey(), properties.getSecretKey());
      return  client;
   }

}